package top.tagao.m03_beHavioralPatterns.b_11_Iterator.college;

import top.tagao.m03_beHavioralPatterns.b_11_Iterator.Department;
import top.tagao.m03_beHavioralPatterns.b_11_Iterator.iterators.InfoCollegeIterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author Viktor_Liu
 * @Date 2022/8/14 23:21
 */
public class InfoCollege implements  College {
    List<Department> departmentList;


    public InfoCollege() {
        departmentList = new ArrayList<Department>();
        addDepartment("信息安全专业", " 信息安全专业 ");
        addDepartment("网络安全专业", " 网络安全专业 ");
        addDepartment("服务器安全专业", " 服务器安全专业 ");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departmentList.add(department);
    }


    @Override
    public Iterator iterator() {
        return new InfoCollegeIterator(departmentList);
    }
}
